package br.com.trimark.utils.exception;

import org.apache.log4j.Logger;

/**
 * Domain Exception Encapsulates all exceptions thrown in domain methods for
 * further processing.
 * 
 * @see java.lang.Exception
 * @see br.com.ctbc.portal.utils.exceptions.BusinessException
 * 
 */

public class BusinessException extends Exception {

	private static final long serialVersionUID = 7407763139351028072L;

	private final Logger logger = Logger.getLogger(BusinessException.class);

	/**
	 * Instantiates a new Exception, given an error message.
	 * 
	 * @param message
	 *            - String with error message
	 */
	public BusinessException(String message) {
		super(message);
	}

	/**
	 * Instantiates a new Exception, given a cause.
	 * 
	 * @param cause
	 *            - Throwable originary exception
	 */
	public BusinessException(Throwable cause) {
		super(cause);
		logger.error("[DomainException] Exception in Domain Layer: " + cause.getMessage());
	}

	/**
	 * Instantiates a new Exception, given a message and a cause.
	 * 
	 * @param message
	 *            - String with error message
	 * @param cause
	 *            - Throwable originary exception
	 */
	public BusinessException(String message, Throwable cause) {
		super(message, cause);
		logger.error("[DomainException] Exception in Domain Layer: " + cause.getMessage());
	}
}
